import {AzraelFrameWorkComponent} from "../Base/AzraelFrameWork";
import {IFsmManager} from "../../src/Fsm/IFsmManager";
import GameFrameworkEntry from "../../src/Base/GameFrameworkEntry";
import {IFsm} from "../../src/Fsm/IFsm";
import FsmBase from "../../src/Fsm/FsmBase";
import {FsmState} from "../../src/Fsm/FsmState";
import GameFrameworkModule from "../../src/Base/GameFrameworkModule";
import FsmManager from "../../src/Fsm/FsmManager";
const {ccclass,property} = cc._decorator;
@ccclass
export class FsmComponent extends AzraelFrameWorkComponent {
    private _FsmManager:IFsmManager & GameFrameworkModule = null;

    protected onLoad(): void {
        super.onLoad();
        this._FsmManager = GameFrameworkEntry.GetModule(FsmManager);
    }

    public get Count():number
    {
        return this._FsmManager.Count();
    }


    public HasFsm(name:string):boolean{
        return this._FsmManager.HasFsm(name);
    }

    public GetFsm<T>(name:string):IFsm<T>|FsmBase{
        return this._FsmManager.GetFsm(name);
    }

    public CreateFsm<T>(owner,name:string,states:FsmState<T>[]):IFsm<T>|FsmBase{
        return this._FsmManager.CreateFsm(owner,name,states)
    }

    public DestroyFsm<T>(name:string):boolean{
        return this._FsmManager.DestroyFsm(name);
    }


}